<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/**
*
* @package  RealEstateManager
* @copyright 2011 Andrey Kvasnevskiy-OrdaSoft(akbet@mail.ru); Rob de Cleen(rob@decleen.com); 
* Homepage: http://www.ordasoft.com
* @version: 2.1 free $
*
**/

require_once ($mosConfig_absolute_path."/libraries/joomla/factory.php");
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

?>

<?php
// ensure this file is being included by a parent file
  $mainframe =& JFactory::getApplication();
  // JURI::base() - adds 'http://localhost/test16'
  $templateDir =   'templates/' . $mainframe->getTemplate() ;                 
  $GLOBALS['mainframe'] = $mainframe;
  $GLOBALS['templateDir'] = $templateDir;
  $mosConfig_live_site = JURI::root(true); 
  $GLOBALS['mosConfig_live_site'] = $mosConfig_live_site;
  $doc =& JFactory::getDocument(); 
  $GLOBALS['doc'] = $doc; 


$bid = mosGetParam($_POST, 'bid', array (0));


require_once ($mosConfig_absolute_path."/administrator/components/com_realestatemanager/admin.realestatemanager.class.others.php");


function catOrderDownIcon( $i, $n, $index, $task='orderdown', $alt='Move Down' ) {
  global $templateDir;
	if ($i < $n-1 ) {
		return '<a href="#reorder" onclick="return listItemTask(\'cb'.$index.'\',\''.$task.'\')" title="'.$alt.'">
			<img src="'.$templateDir.'/images/admin/downarrow-1.png" width="12" height="12" border="0" alt="'.$alt.'" />
		</a>';
	} else {
		return '&nbsp;';
	}
}

function catOrderUpIcon( $i,$index, $task='orderup', $alt='Move Up' ) {
  global $templateDir;
	if ($i > 0 ) {
		return '<a href="#reorder" onclick="return listItemTask(\'cb'.$index.'\',\''.$task.'\')" title="'.$alt.'">
			<img src="'.$templateDir.'/images/admin/uparrow-1.png" width="12" height="12" border="0" alt="'.$alt.'" />
		</a>';
	} else {
		return '&nbsp;';
	}
}



class HTML_Categories
{

function show(&$rows, $myid, &$pageNav, &$lists, $type)
{
  global $my,$mosConfig_live_site, $templateDir, $doc;

  $doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );

  $section = "com_realestatemanager";
  $section_name = "RealEstateManager";

        ?>
		<form action="index.php" method="post" name="adminForm" id="adminForm">

		<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
      <td width="30%">
              <img src="./components/com_realestatemanager/images/building_icon.jpg" align="right" alt="Config" />
      </td>
      <td width="70%" class="house_manager_caption" valign='bottom' >
				<?php echo _REALESTATE_MANAGER_CATEGORIES_MANAGER; ?>
			</td>
		</tr>
		</table>
		
		<table class="adminlist">
		<tr>
			<th width="20" align="center">
			#
			</th>
			<th width="20">
			<input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($rows);?>);" />
			</th>
			<th align = "center" class="title">
			<?php echo _HEADER_CATEGORY;?>
			</th>
			<th align = "center" width="5%">
			<?php echo _HEADER_NUMBER;?>
			</th>

			<th align = "center" width="10%">
			<?php echo _HEADER_PUBLISHED;?>
			</th>
			<?php
        if ($section <> 'content') {
        	?>
				<th align = "center" colspan="2">
				<?php echo _HEADER_REORDER;?>
				</th>
				<?php
        } 

        ?>
			<th align = "center" width="10%">
			<?php echo _HEADER_ACCESS;?>
			</th>
			<?php
        if ($section == 'content') {

            ?>
				<th width="12%" align="left">
				Section
				</th>
				<?php
        } 

        ?>
			<th align = "center" width="12%">
			ID
			</th>
			<th align = "center" width="12%">
			<?php echo _HEADER_CHECKED_OUT;?>
			</th>
		  </tr>
		<?php
        $k = 0;
        $i = 0;
        $n = count($rows);
        foreach ($rows as $row) {
            $img = $row->published ? 'tick.png' : 'publish_x.png';
            $task = $row->published ? 'unpublish' : 'publish';
            $alt = $row->published ? 'Published' : 'Unpublished';
            ?>
			<tr class="<?php echo "row$k";?>">
				<td width="20" align="center">
				<?php echo $pageNav->getRowOffset($i);?>
				</td>
				<td width="20">
				<?php echo mosHTML::idBox($i, $row->id, ($row->checked_out_contact_category && $row->checked_out_contact_category != $my->id),'bid');?>
				</td>
				<td width="35%">
				<?php
            if ($row->checked_out_contact_category && ($row->checked_out_contact_category != $my->id)) {

                ?>
					<?php echo $row->treename . ' ( ' . $row->title . ' )';?>
					&nbsp;[ <i>Checked Out</i> ]
					<?php
            } else {

                ?>
					<a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
					<?php echo $row->treename . ' ( ' . $row->title . ' )';?>
					</a>
					<?php
            } 

            ?>
				</td>
				<td align="center">
				<?php echo $row->cc;?>
				</td>

				<td align="center">
				<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
				<img src="<?php echo$templateDir . "/images/admin/" . $img; ?>" width="12" height="12" border="0" alt="<?php echo $alt;?>" />
				</a>
				</td>

					<!-- old td  >
					<?php echo $i. $pageNav->orderUpIcon($i);?>
					</td>
					<td>
					<?php echo $i. "::".$n.$pageNav->orderDownIcon($i, $n);?>
					</td-->
					<td align="center">
					<?php

                                         echo catOrderUpIcon($row->ordering - 1,$i);?>
					</td>
					<td align="center">
					<?php

                                          echo catOrderDownIcon($row->ordering -1 , $row->all_fields_in_list   , $i );?>
					</td>

				<td align="center">
        <!--<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task_access;?>')" <?php echo $color_access;?>>-->
        <?php echo "Everybody";?>
        <!--</a>-->
				</td>
				<td align="center">
				<?php echo $row->id;?>
				</td>
				<td align="center">
				<?php echo $row->checked_out_contact_category ? $row->editor : "";?>				
				</td>
				<?php
            $k = 1 - $k;

            ?>
			</tr>
			<?php
            $k = 1 - $k;
            $i++;
        } 

        ?>
                <tr><td colspan = "11"><?php echo $pageNav->getListFooter();?></td></tr>
		</table>
		
	
		<input type="hidden" name="option" value="com_realestatemanager" />
		<input type="hidden" name="section" value="categories" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="chosen" value="" />
		<input type="hidden" name="act" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="type" value="<?php echo $type;?>" />
		</form>
		<?php
    } 


/**
    * Writes the edit form for new and existing categories
    * 
    * @param $ The category object
    * @param string $ 
    * @param array $ 
    */
    function edit(&$row, $section, &$lists, $redirect)
    {
global $my, $mosConfig_live_site,$mainframe;

  $doc =& JFactory::getDocument();
  $doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );
  $doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');

        global $mosConfig_live_site,$option;
        if ($row->image == "") {
            $row->image = 'blank.png';
        } 
        mosMakeHtmlSafe($row, ENT_QUOTES, 'description');

        ?>
		<script language="javascript" type="text/javascript">
		Joomla.submitbutton = function(pressbutton, section) {
			var form = document.adminForm; 
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			if ( form.name.value == "" ) {
				alert('<?php echo _DML_CAT_MUST_SELECT_NAME;?>');
			} else {
				<?php getEditorContents('editor1', 'description') ;?>
				submitform(pressbutton);
			}
		}
		</script>

		<form action="index.php" method="post" name="adminForm" id="adminForm">
		<table >
		<tr>
			<th  class="house_manager_caption" align="left">
			<?php echo $row->id ? _HEADER_EDIT : _HEADER_ADD;?> <?php echo _CATEGORY;?> <?php echo $row->name;?>
			</th>
		</tr>
		</table>

		<table width="100%">
		<tr>
			<td valign="top">


				<table class="adminform">
				<tr>
					<th colspan="3">
					  <?php echo _CATEGORIES__DETAILS;?>
					</th>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_TITLE;?>:
					</td>
					<td colspan="2">
					  <input class="text_area" type="text" name="title" value="<?php echo $row->title;?>" size="50" maxlength="250" title="A short name to appear in menus" />
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_NAME;?>:
					</td>
					<td colspan="2">
					  <input class="text_area" type="text" name="name" value="<?php echo $row->name;?>" size="50" maxlength="255" title="A short name to appear in menus" />
					</td>
				</tr>
				<tr>
					<td align="right">
                                          <?php echo _CATEGORIES__PARENTITEM;?>:</td>
                                 	<td>
					  <?php echo $lists['parent'];?>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_IMAGE;?>:
					</td>
					<td>
					   <?php echo $lists['image'];?>
					</td>
					<td rowspan="4" width="50%">
					<script language="javascript" type="text/javascript">
					  if (document.forms[0].image.options.value!=''){
					     jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'image' );
					   } 
                                            else 
                                           {
					    jsimg='../images/M_images/blank.png';
					   }
					document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo _CATEGORIES__IMAGEPREVIEW;?>" />');
					</script>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_IMAGEPOS;?>:
					</td>
					<td>
					  <?php echo $lists['image_position'];?>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_ORDER;?>:
					</td>
					<td>
					  <?php echo $lists['ordering'];?>
					</td>
				</tr>
				<tr>
					<td align = "center">
					  <?php echo _HEADER_ACCESS;?>:
					</td>
					<td>
            <?php echo "Everybody";?>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _HEADER_PUBLISHED;?>:
					</td>
					<td>
					  <?php echo $lists['published'];?>
					</td>
				</tr>
				<tr>
					<td valign="top">
					  <?php echo _CATEGORIES__DETAILS;?>:
					</td>
					<td colspan="2">
					<?php 
        // parameters : areaname, content, hidden field, width, height, rows, cols
        editorArea('editor1', $row->description , 'description', '500', '200', '50', '5') ;
        ?>
				    </td>
				</tr>
			   </table>
			</td>
		    </tr>
		</table>

		<input type="hidden" name="option" value="com_realestatemanager" />
		<input type="hidden" name="section" value="categories" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="oldtitle" value="<?php echo $row->title ;?>" />
		<input type="hidden" name="id" value="<?php echo $row->id;?>" />
		<!--input type="hidden" name="sectionid" value="com_realestatemanager" /-->
		<input type="hidden" name="redirect" value="<?php echo $redirect;?>" />
		</form>
		<?php
    } 
} 


    

/**
* realestatemanager  Class
* Handles the import  data from the realestatemanager.
*/

class HTML_realestatemanager 
{


function edit_review($option, $house_id, &$review) {

global $my, $mosConfig_live_site,$mainframe, $doc;
$doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');
?>
		<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">

		<table cellpadding="4" cellspacing="5" border="0" width="100%" class="adminform">
    	<tr>
      	<td colspan="2">
	        <?php echo _REALESTATE_MANAGER_LABEL_REVIEW_TITLE; ?>
        </td>
      </tr>
      <tr>
        <td colspan="2">
           <input class="inputbox" type="text" name="title" size="80" 
							value="<?php echo $review[0]->title ?>" />
        </td>
      </tr>
      <tr>
        <td>
            <?php echo _REALESTATE_MANAGER_LABEL_REVIEW_COMMENT; ?>
        </td>
        <td align="left" >
           <?php echo _REALESTATE_MANAGER_LABEL_REVIEW_RATING; ?>
        </td>
      </tr>
      <tr>
        <td>
         <!--<textarea align="top" name="comment" id="comment" cols="60" rows="10" style="width:400;height:100;"/></textarea>-->
           <?php
             editorArea( 'editor1',  $review[0]->comment , 'comment', '410', '200', '60', '10' );    
            ?>
        </td>
				<td width="102" align='left'>
           <?php
			       $k = 0;
             while($k < 11){
           ?>
            <input type="radio" name="rating" value="<?php echo $k; ?>" 
                     <?php if($k == $review[0]->rating ) echo 'checked="checked"'; ?> alt="Rating" />
           
            <img src="../components/com_realestatemanager/images/rating-<?php echo $k; ?>.gif" 
							alt="<?php echo ($k)/2; ?>" border="0" /><br />
           <?php
	             $k ++;
             } 
           ?>
         </td>
       </tr>
       <tr>
	       <td colspan="2">&nbsp;
	          
         </td>
       </tr>

	  </table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="update_review" />
		<input type="hidden" name="house_id" value="<?php echo $house_id; ?>" />
		<input type="hidden" name="review_id" value="<?php echo $review[0]->id; ?>" />
	</form>
<?php
}




//*************   begin for manage reviews   ********************
function edit_manage_review($option, & $review) {
global $my, $mosConfig_live_site,$mainframe, $doc;
$doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');
?>
		<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
		<table cellpadding="4" cellspacing="5" border="0" width="100%" class="adminform">
    	<tr>
      	<td colspan="2">
	        <?php echo _REALESTATE_MANAGER_LABEL_REVIEW_TITLE; ?>
        </td>
      </tr>
      <tr>
        <td colspan="2">
           <input class="inputbox" type="text" name="title" size="80" 
							value="<?php echo $review[0]->title ?>" />
        </td>
      </tr>
      <tr>
        <td>
            <?php echo _REALESTATE_MANAGER_LABEL_REVIEW_COMMENT; ?>
        </td>
        <td align="left" >
           <?php echo _REALESTATE_MANAGER_LABEL_REVIEW_RATING; ?>
        </td>
      </tr>
      <tr>
        <td>
         <!--<textarea align= "top" name="comment" id="comment" cols="60" rows="10" style="width:400;height:100;"/></textarea>-->

           <?php
              editorArea( 'editor1',  $review[0]->comment , 'comment', '410', '200', '60', '10' ) ; 
             ?>
        </td>
				<td width="102" align='left'>
           <?php
			       $k = 0;
             while($k < 11){
           ?>
           <input type="radio" name="rating" value="<?php echo $k; ?>" 
							<?php if($k == $review[0]->rating ) echo 'checked="checked"'; ?> alt="Rating" />
           <img src="../components/com_realestatemanager/images/rating-<?php echo $k; ?>.gif" 
							alt="<?php echo ($k)/2; ?>" border="0" /><br />
           <?php
	             $k ++;
             } 

           ?>
         </td>
       </tr>
       <tr>
	       <td colspan="2">&nbsp;
	          
         </td>
       </tr>

	  </table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="update_edit_manage_review" />
		<input type="hidden" name="review_id" value="<?php echo $review[0]->id; ?>" />
	</form>
<?php
}
//***************   end for manage reviews   ********************

function showRequestRentHouses($option, & $rent_requests, & $pageNav)
{
global $my, $mosConfig_live_site,$mainframe;

$doc = JFactory::getDocument();
$doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );
$doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');

?>
		<form action="index.php" method="post" name="adminForm" id="adminForm">

		<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
      <td width="30%">
         <img src="./components/com_realestatemanager/images/building_icon.jpg" align="right" alt="Config" />
      </td>
      <td width="70%" class="house_manager_caption" valign='bottom' >
				<?php echo _REALESTATE_MANAGER_ADMIN_REQUEST_RENT; ?>
			</td>
		</tr>
		</table>

		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
  		<tr>
				<th align = "center" width="20">
					<input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $rent_requests ); ?>);" />
				</th>
				<th align = "center" width="30">#</th>
				<th align = "center" class="title" width="10%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_RENT_FROM;?></th>
				<th align = "center" class="title" width="10%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_RENT_UNTIL;?></th>
				<th align = "center" class="title" width="5%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_HOUSEID;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_ADDRESS;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_RENT_USER;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_RENT_EMAIL;?></th>
				<th align = "center" class="title" width="20%" nowrap="nowrap">
          <?php echo _REALESTATE_MANAGER_LABEL_RENT_ADRES;?></th>
			</tr>
<?php





			
			$datarent = &JFactory::getDBO();
						
			
			$query ="SELECT * FROM #__rem_rent_request  WHERE fk_houseid=4";	
		
			$datarent->setQuery( $query);
		 	$rentrequest = $datarent->loadObjectList();
		
	
for ($i = 0, $n = count($rent_requests); $i < $n; $i ++) {
			$row = & $rent_requests[$i];
?>		


			<tr class="row<?php echo $i % 2; ?>">
				<td width="20" align="center">

<?php				//if ($row->fk_rentid != 0) {?>
							<!--	&nbsp;-->
<?php
	//				} else {//print_r($row->fk_rentid );
						echo mosHTML::idBox( $i, $row->id, 0, 'bid' );					
						// print_r($row->fk_rentid );					
//}
?>
				</td>
				<td align = "center"><?php echo $row->id; ?></td>
				<td align = "center">
					<?php echo $row->rent_from; ?>
				</td>
				<td align = "center">
					<?php echo $row->rent_until; ?>
				</td>
				<td align = "center"><?php echo $row->houseid; ?></td>

<!--
				<td align = "center">
					<?php echo $row->mls; ?>
				</td>
-->

				<td align = "center">
					<?php echo $row->htitle; ?>
				</td>
				<td align = "center">					
					<?php echo $row->user_name; ?>
				</td>
				<td align = "center">
					<a href=mailto:"<?php echo $row->user_email; ?>">
						<?php echo $row->user_email; ?>
					</a>
				</td>
				<td align = "center">
					<?php echo $row->user_mailing; ?>
				</td>
			</tr>
		<?php
		}		

?>
                <tr><td colspan = "11"><?php echo $pageNav->getListFooter();?></td></tr>
		</table>
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="rent_requests" />
		<input type="hidden" name="boxchecked" value="0" />
		</form>

<?php

}


function showRequestBuyingHouses($option, $buy_requests, $pageNav)
{
global $my, $mosConfig_live_site,$mainframe;
$doc = JFactory::getDocument();

$doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );
$doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');

?>
	<form action="index.php" method="post" name="adminForm" id="adminForm">
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
      <td width="30%">
          <img src="./components/com_realestatemanager/images/building_icon.jpg" align="right" alt="Config" />
      </td>
      <td width="70%" class="house_manager_caption" valign='bottom' >
				<?php echo _REALESTATE_MANAGER_ADMIN_SALE_MANAGER; ?>
			</td>
		</tr>
	</table>
	
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
			<tr>
				<th align = "center" width="20">
					<input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $buy_requests ); ?>);" />
				</th>
				<th align = "center" width="30">#</th>
				<th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_HOUSEID;?></th>
<!--
				<th align = "center" class="title" width="10%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_MLS;?></th>
-->
				<th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_ADDRESS;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_RENT_USER;?></th>
        <th align = "center" class="title"  nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_COMMENT;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_RENT_EMAIL;?></th>
				<th align = "center" class="title" width="20%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_BUYING_ADRES;?></th>
			</tr>
		<?php
		for ($i = 0, $n = count($buy_requests); $i < $n; $i ++) {
			$row = & $buy_requests[$i];
		?>
			<tr class="row<?php echo $i % 2; ?>">
				<td width="20">
<?php				if ($row->fk_rentid != 0) { ?>
					&nbsp;
<?php
					} else {
?>
						<div align = "center">
<?php
						echo mosHTML::idBox( $i, $row->id, ($row->fk_rentid != 0), 'bid' );
?>
						</div>
<?php
					}
?>
				</td>

				<td align = "center"><?php echo $row->id; ?></td>
				<td align = "center"><?php echo $row->fk_houseid; ?></td>
<!--
				<td align = "center"><?php echo $row->mls; ?></td>
-->
				<td align = "center"><?php echo $row->hlocation; ?></td>
				<td align = "center"><?php echo $row->customer_name; ?></td>
        <td align = "center" widt="30%"><?php echo $row->customer_comment; ?></td>
				<td align = "center">
					<a href=mailto:"<?php echo $row->customer_email; ?>">
						<?php echo $row->customer_email; ?>
					</a>
				</td>
				<td align = "center"><?php echo $row->customer_phone; ?></td>
			</tr>
		<?php } ?>
	</table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="buy_requests" />
		<input type="hidden" name="boxchecked" value="0" />
	</form>
<?php
}

function showHouses($option, & $rows_house, & $clist, & $rentlist, & $publist, & $search, & $pageNav)
{
global $my, $mosConfig_live_site,$mainframe,$session, $doc;
global $templateDir; // for J 1.6


$doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');

$doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );?>
		<form action="index.php" method="post" name="adminForm" id="adminForm">

		<table cellpadding="4" cellspacing="0" border="0" width="100%">
                                <tr>
        	                <td width="30%">
                                   <img src="./components/com_realestatemanager/images/building_icon.jpg" align="right" alt="Config" />
                                </td>

	                        <td width="68%" class="house_manager_caption" valign='bottom' >
				  <?php echo _REALESTATE_MANAGER_SHOW;?>
				</td>
				</tr>
			</table>

		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		<tr>
			<td>
				<?php echo _REALESTATE_MANAGER_SHOW_SEARCH;?>
			</td>
			<td>
                        
                    <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
			</td>
			<td>
				<?php echo $publist;?>
			</td>
			<td>
				<?php echo $rentlist;?>
			</td>

			<td >
				<?php echo $clist;?>
			</td>
		</tr>
		</table>

<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
<tr>
  <th width="20">
   <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $rows_house ); ?>);" />
  </th>
  <th width="30">#</th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_HOUSEID;?></th>
<!--  <th align = "center"  class="title" width="12%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_MLS;?></th> -->
  <th align = "center" class="title" width="27%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_ADDRESS;?></th>
  <th align = "center" class="title" width="27%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_TITLE;?></th>
  <th align = "center" class="title" width="16%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_CATEGORY;?></th>
  <th align = "center" class="title" width="10%" nowrap="nowrap">Destaque</th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_HITS;?></th>		
  <th align = "center"  class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_PUBLIC;?></th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_APPROVED;?></th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_CONTROL;?></th>
</tr>
<?php


		for ($i = 0, $n = count($rows_house); $i < $n; $i ++) {
			$row = & $rows_house[$i];

?>											
			<tr class="row<?php echo $i % 2; ?>">

				<td width="20" align="left">
					<?php		if ($row->checked_out && $row->checked_out != $my->id) { ?>
						&nbsp;
<?php
								} else {
									echo mosHTML::idBox( $i, $row->id, ($row->checked_out && $row->checked_out != $my->id ), 'bid' );
								}
?>
				</td>
				<td align = "center" ><?php echo $row->id; ?></td>
				<td align = "center"><?php echo $row->houseid; ?></td>
				
<!--                                <td align="center">
					<a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
						<?php echo $row->mls; ?>
					</a>
				</td>  
-->

				<td align="left">
					<a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
						<?php echo $row->hlocation; ?>
					</a>
				</td>
				<td align="left">
					<a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
						<?php echo $row->htitle; ?>
					</a>
				</td>
				<td align = "center"><?php echo $row->category; ?></td>
				<td align = "center">
				<?php echo $row->is_featured == 1 ? "Sim" : "Não";?>
				</td>

				<td align = "center"><?php echo $row->hits; ?></td>
			<?php
			$task = $row->published ? 'unpublish' : 'publish';
			$alt = $row->published ? 'Unpublish' : 'Publish';
			$img = $row->published ? 'tick.png' : 'publish_x.png';

			$task1 = $row->approved ? 'unapprove' : 'approve';
 			$alt1 = $row->approved ? 'Unapproved' : 'Approved';
 			$img1 = $row->approved ? 'tick.png' : 'publish_x.png';
          
			?>
		<td width="5%" align="center">
			<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
			<img src="<?php echo$templateDir . "/images/admin/" . $img; ?>" width="12" height="12" border="0" alt="<?php echo $alt;?>" />
			</a>
		</td>
		<td width="5%" align="center">
			<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task1;?>')">
			<img src="<?php echo$templateDir . "/images/admin/" . $img1; ?>" width="12" height="12" border="0" alt="<?php echo $alt1;?>" /></a>
		</td>

			<?php
			if ($row->checked_out) {
			?>
				<td align="center"><?php echo $row->editor; ?></td>
<?php			} else { ?>
				<td align="center">&nbsp;</td>
<?php				} ?>
			</tr>
<?php	
		}//end for
?>
                <tr><td colspan = "13"><?php echo $pageNav->getListFooter();?></td>
		</tr>
		</table>
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		</form>

<?php
}

/**
* Writes the edit form for new and existing records
*
*/
function editHouse($option, & $row, & $clist, & $rating, & $delete_edoc, & $reviews, & $test_list,
  & $listing_status_list, & $property_type_list, & $typology_list, & $districts, & $councils, & $parish, & $listing_type_list, & $provider_class_list, & $zoning_list,
  & $style_list, & $house_photos)
{


	global $realestatemanager_configuration;
	global $my, $mosConfig_live_site,$mainframe, $doc;

//  $doc->addStyleSheet( $mosConfig_live_site.'/includes/js/calendar/calendar-mos.css' );
  $doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');
//  $doc->addScript($mosConfig_live_site.'/includes/js/calendar/calendar.js');
//  $doc->addScript($mosConfig_live_site.'/includes/js/calendar/lang/calendar-en-GB.js');
  $doc->addScript($mosConfig_live_site.'/includes/js/jquery-1.6.js');

?>



<script language="javascript" type="text/javascript">

 function trim(string){
	return string.replace(/(^\s+)|(\s+$)/g, "");
 }
 Joomla.submitbutton = function(pressbutton) {

	var form = document.adminForm;


	if (pressbutton == 'save') {
		if (trim(form.houseid.value) == '') {

      alert( "<?php echo _REALESTATE_MANAGER_ADMIN_INFOTEXT_JS_EDIT_HOUSEID_CHECK; ?>" );
      return;
    } else if (form.catid.value == 0) {

			alert( "<?php echo _REALESTATE_MANAGER_ADMIN_INFOTEXT_JS_EDIT_CATEGORY; ?>");
			return;
    }else if (form.hlocation.value == '') {

			alert( "<?php echo _REALESTATE_MANAGER_ADMIN_INFOTEXT_JS_EDIT_ADDRESS; ?>");
			return;
    }else if (form.price.value == '' ||form.priceunit.value=='') {

			alert( "<?php echo _REALESTATE_MANAGER_ADMIN_INFOTEXT_JS_EDIT_PRICE; ?>");
			return;
    }else if (form.htitle.value == '') {

			alert( "<?php echo _REALESTATE_MANAGER_ADMIN_INFOTEXT_JS_EDIT_TITLE; ?>");
			return;
    }else if (!form.bathrooms.value.test("^([0-9]*)$") ) {

			alert( "<?php echo _REALESTATE_MANAGER_INFOTEXT_JS_BATHROOMS; ?>");
			return;
    }else if (!form.bedrooms.value.test("^([0-9]*)$") ) {

			alert( "<?php echo _REALESTATE_MANAGER_INFOTEXT_JS_BEDROOMS; ?>");
			return;
    }else if (!form.property_taxes.value < 0 || form.property_taxes.value > 1) {

			alert( "<?php echo _REALESTATE_MANAGER_ADMIN_INFOTEXT_JS_EDIT_PROPERTY_TAXES; ?>");
			return;
    }else {

      submitform( pressbutton );

    }
	} else {
               submitform( pressbutton );
        }

 }
var photos=0;
function new_photos()
{
  div=document.getElementById("items");
    button=document.getElementById("add");
    photos++;
    newitem="<strong>" + "<?php echo _REALESTATE_MANAGER_ADMIN_NEW_PHOTO ?>" + photos + ": </strong>";
    newitem+="<input type=\"file\" name=\"new_photo_file[]";
    newitem+="\" value=\"\"size=\"45\"><br>";
    newnode=document.createElement("span");
    newnode.innerHTML=newitem;
    div.insertBefore(newnode,button);
}

</script>


		<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="15%" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_HOUSEID;?>:</strong>				
			</td>
			<td width="85%" align="left">
				<input class="inputbox" type="text" name="houseid" size="20" maxlength="20" value="<?php echo $row->houseid;?>" />
			</td>
		</tr>

		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_CATEGORY;?>:</strong>
			</td>
			<td align="left">
				<?php echo $clist; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_COMMENT;?>:</strong>
			</td>
			<td align="left">
				<?php
					editorArea( 'editor1',  $row->description, 'description', 500, 250, '70', '10' ) ;

				?>
				<!--<textarea name="comment" id="comment" cols="50" rows="25" style="width:800;height:200;"><?php /*echo $row->comment;*/?></textarea>-->
			</td>
		</tr>
		<?php if ($realestatemanager_configuration['edocs']['allow']){
		?>	
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_EDOCUMENT_UPLOAD;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="file" name="edoc_file" value="" size="50" maxlength="250" onClick="document.adminForm.edok_link.value ='';"/>    <!-- //+ -->
			</td>
		</tr>		
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_EDOCUMENT_UPLOAD_URL;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="edok_link" value="<?php echo $row->edok_link; ?>" size="50" maxlength="250"/>
			</td>
		</tr>		
		<?php
		}
		if (strlen($row->edok_link) > 0 ){
		?>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_EDOCUMENT_DELETE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $delete_edoc; ?>
			</td>
		</tr>
		<?php
		}
		?>		
		<tr>
			<td colspan="2">			  				
  				<hr size="2" width="100%" />
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<h3><?php echo _REALESTATE_MANAGER_HEADER_REQUIREMENT_FIELDS;?></h3>
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_LISTING_TYPE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $listing_type_list;?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong>Em destaque:</strong>
			</td>
			<td align="left">
				<input type="checkbox" value="1" name="is_featured" id="is_featured" <?php if($row->is_featured == 1) echo " checked=\"checked\"";?> />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_PRICE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="price" size="15" value="<?php echo $row->price;?>" />&nbsp;
        <input class="inputbox" type="text" name="priceunit" size="15" value="<?php echo $row->priceunit;?>" />
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_PRISE_TYPE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $test_list; ?>
			</td>
		</tr>


		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_TITLE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="htitle" size="80" value="<?php echo $row->htitle;?>" />
			</td>
		</tr>
		<tr>
			<td colspan="2">	
  				<hr size="2" width="100%" />
			</td>
		</tr>
<!--Roman editions -->
		
		<tr>
			<td colspan="2">
				<h3><?php echo _REALESTATE_MANAGER_HEADER_ADDRESS_FIELDS;?></h3>
			</td>
		</tr>
    <tr style="display:none">
      <td valign="top" align="right">
        <strong><?php echo _REALESTATE_MANAGER_LABEL_COUNTRY;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="hcountry" size="50" value="<?php echo $row->hcountry;?>" />
      </td>
    </tr>
    <tr style="display:none">
      <td valign="top" align="right">
        <strong><?php echo _REALESTATE_MANAGER_LABEL_REGION;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="hregion" size="50" value="<?php echo $row->hregion;?>" />
      </td>
    </tr>
    <tr style="display:none">
      <td valign="top" align="right">
        <strong><?php echo _REALESTATE_MANAGER_LABEL_CITY;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="hcity" size="50" value="<?php echo $row->hcity;?>" />
      </td>
    </tr>
	<tr>
      <td valign="top" align="right">
        <strong><?php echo _REALESTATE_MANAGER_LABEL_DISTRICT;?>:</strong>
      </td>
      <td align="left">
			<?php echo $districts; ?>
      </td>
    </tr>
	<tr>
      <td valign="top" align="right">
        <strong><?php echo _REALESTATE_MANAGER_LABEL_COUNCIL;?>:</strong>
      </td>
      <td align="left">
			<?php echo $councils; ?>
      </td>
    </tr>
	<tr>
      <td valign="top" align="right">
        <strong><?php echo _REALESTATE_MANAGER_LABEL_PARISH;?>:</strong>
      </td>
      <td align="left">
			<?php echo $parish; ?>
      </td>
    </tr>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#district').change(function(){
			$.get('<?php echo $mosConfig_live_site;?>/index.php?option=com_realestatemanager&task=get_councils_admin&tmpl=blank&id_district='+$('#district').val(), function(data){
				$('#council').html(data);
				$('#parish').html("<option value=\"all\"><?php echo _REALESTATE_MANAGER_ADMIN_PLEASE_SEL;?></option>");
			});
		});
		$('#council').change(function(){
			$.get('<?php echo $mosConfig_live_site;?>/index.php/component/realestatemanager/?option=com_realestatemanager&task=get_parish_admin&tmpl=blank&id_council='+$('#council').val(), function(data){
				$('#parish').html(data);
			});
		});
	});
	</script>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_ADDRESS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="hlocation" size="80" value="<?php echo $row->hlocation;?>" />
			</td>
		</tr>
    <tr>
       <td>
            <strong><?php echo _REALESTATE_MANAGER_LABEL_OWNER;?>:</strong>
       </td>
       <td>
            <?php
           if(trim($row->owneremail) != "" ):?>
                 <?php echo $row->getOwnerUsername(),'(',$row->owneremail,')';?>
                 <input type='hidden' name='owneremail' value="<?php echo $row->owneremail;?>"/>
            <?php else:?>
                 <input type='hidden' name='owneremail' value="<?php echo $my->email;?>"/>
            <?php endif;?>
       </td>
    </tr>
		<tr>
			
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_LATITUDE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" id="hlatitude" name="hlatitude" size="20" value="<?php echo $row->hlatitude;?>" readonly/>
			</td>
		</tr>
		<tr>
			
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_LONGITUDE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" id="hlongitude" name="hlongitude" size="20" value="<?php echo $row->hlongitude;?>" readonly/>
				<input type="hidden" name="map_zoom" value="<?php echo $row->map_zoom;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong>Click on the map to choose the house location:</strong>
			</td>				
			<td align="left">
				<div id="map_canvas" style="width:400px; height:300px; border: 1px solid black; float: left;"></div>	
<!--Image google map-->	
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=<?php echo $realestatemanager_configuration['google_map']['key']; ?>"
    type="text/javascript">
  </script>
		
<script type="text/javascript">
			var map;
    	var lastmarker = null;
  			
			if (GBrowserIsCompatible()) 
			{
     			map = new GMap2(document.getElementById("map_canvas"));
			
          //Set map center
          map.setCenter(new GLatLng(<?php if($row->hlatitude) echo $row->hlatitude;else echo 0; ?>, 
          <?php if($row->hlongitude) echo $row->hlongitude;else echo 0; ?>), 
          <?php if(($row->map_zoom)!=0) echo $row->map_zoom;else echo 1; ?>);
          

           /*set type map: G_HYBRID_MAP, G_NORMAL_MAP, G_SATELLITE_MAP*/
          map.setMapType(G_HYBRID_MAP);
          
          var mapTypeControl = new GMapTypeControl();
          /*sep position for button with paps types*/
          var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(5,5));
          map.addControl(mapTypeControl, topRight); /* topRight вывод самих кнопок*/
          /*GSmallMapControl() -- Создает контроль с кнопками, +- право/лево в  угол*/
          var mapZoomControl = new GSmallMapControl();			
          map.addControl(mapZoomControl);

          //Установка маркера с координатами дома	
          <?php if ($row->hlatitude && $row->hlongitude) 	
          { ?>  
             lastmarker = new GMarker(new GLatLng(<?php echo $row->hlatitude; ?>, <?php echo $row->hlongitude; ?>),false);
             map.addOverlay( lastmarker );	
		  <?php } ?>   
			 
            //Если изменяем масшатаб, то сохраняем его в поле map_zoom	
            GEvent.addListener(map,"zoomend", function(oldLevel, newLevel)
            {
              document.adminForm.map_zoom.value=newLevel;		
            });

            GEvent.addListener(map,"click", function(overlay, latlng) 
            {
            //Initialize marker         
              var marker = new GMarker(latlng, false); 
              
              //Delete marker
              if(lastmarker) map.removeOverlay( lastmarker );

              //Add marker to the map
              map.addOverlay( marker );
              //Output marker information
              document.adminForm.hlatitude.value=latlng.lat();
              document.adminForm.hlongitude.value=latlng.lng();
              //Memory marker to delete
              lastmarker = marker;		  
                
              //Text under marker
                  //var comments = "Latitude: " + latlng.lat() + "<br>Longitude: " + latlng.lng();	
                  //map.openInfoWindow(latlng, comments);
            }); //end function and GEvent.addListener */

			}  //end if (GBrowserIsCompatible)
 
</script> 
<!--End google map.Желательно выгружать google с памяти с помощью функции onunload="GUnload()"   -->
		
<!--end Roman editions -->		



<tr>
		<tr>
			<td colspan="2">			  				
  				<hr size="2" width="100%" />
			</td>
		</tr>
				
<!--end Roman editions -->		
		<tr>
			<td colspan="2">
				<h3><?php echo _REALESTATE_MANAGER_HEADER_RECOMMENDED_FIELDS;?></h3>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_BATHROOMS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="bathrooms" size="10" value="<?php echo $row->bathrooms;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_BEDROOMS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="bedrooms" size="10" value="<?php echo $row->bedrooms;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_BROKER;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="broker" size="40" value="<?php echo $row->broker;?>" />
			</td>
		</tr>


		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_CONTACTS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="contacts" size="40" value="<?php echo $row->contacts;?>"   />
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_LISTING_STATUS;?>:</strong>
			</td>
			<td align="left">
				<?php echo $listing_status_list; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_EDITION;?>:</strong>
			</td>
			<td align="left">
				<?php echo $property_type_list; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_TYPOLOGY;?></strong>
			</td>
			<td align="left">
				<?php echo $typology_list;?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_PROVIDER_CLASS;?>:</strong>
			</td>
			<td align="left">
				<?php echo $provider_class_list;?>	
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_BUILD_YEAR;?>:</strong>
			</td>

			<td align="left">

        <select name="year" id="year" class="inputbox" size="1" >
          <option value="0"><?php echo _REALESTATE_MANAGER_ADMIN_PLEASE_SEL;?></option>
        <?php
          $num=1900;
          for($i= 0;$num<=date('Y');$i++)
          {
            print_r("<option value=\"");
            print_r($num);
            print_r("\"");
            if($num == $row->year){
              print(" selected= \"true\" ");
            }
            print_r(">");
            print_r($num);
            print_r("</option>"); 
            $num++;
          }
        ?>
        </select>
     
				<!--<input class="inputbox" type="text" name="year" size="20" id="year" value="<?php echo $row->year;?>" />
				<input type="reset" class="button" value="..." onclick="calendar=null; return showCalendar('year', 'y');" />-->
			</td>
		</tr>
		<tr>
			<td colspan="2">
  				<hr size="2" width="100%" />
			</td>
		</tr>
		<tr>
			<td colspan="2">
  				<h3><?php echo _REALESTATE_MANAGER_HEADER_OPTIONAL_FIELDS?></h3>
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_AGENT;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="agent" size="30" value="<?php echo $row->agent;?>" />				
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_AREA;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="area" size="30" value="<?php echo $row->area;?>" />				
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_EXPIRATION_DATE;?>:</strong>
			</td>
			<td align="left">
				<?php if (trim($row->expiration_date))
				  echo JHtml::_('calendar',$row->expiration_date,'expiration_date','expiration_date','%Y-%m-%d', array('size'=>'30'));
					else echo JHtml::_('calendar',date("Y-m-d",strtotime(date("Y-m-d")." +1 year")),'expiration_date','expiration_date','%Y-%m-%d', array('size'=>'30'));
				?>
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_FEATURE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="feature" size="30" value="<?php echo $row->feature;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_HOA_DUES;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="hoa_dues" size="30" value="<?php echo $row->hoa_dues;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_LOT_SIZE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="lot_size" size="30" value="<?php echo $row->lot_size;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_MODEL;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="model" size="30" value="<?php echo $row->model;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_PROPERTY_TAXES;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="property_taxes" size="30" value="<?php echo $row->property_taxes;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_SCHOOL;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="school" size="30" value="<?php echo $row->school;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_SCHOOL_DISTRICT;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="school_district" size="30" value="<?php echo $row->school_district;?>" />				
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_STYLE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $style_list;?>
			</td>
		</tr>
		<tr style="display:none">
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_ZONING;?>:</strong>
			</td>
			<td align="left">
				<?php echo $zoning_list;?>
			</td>
		</tr>
		<tr>
			<td colspan="2">
  				<hr size="2" width="100%" />
			</td>
		</tr>
		<tr>
			<td colspan="2">
  				<h3><?php echo _REALESTATE_MANAGER_HEADER_PHOTO_MANAGE; ?></h3>
			</td>
		</tr>
		<!--<tr>
			<td valign="top" align="right">
				<strong><?php /*echo _REALESTATE_MANAGER_LABEL_RATING;*/?>:</strong>
			</td>
			<td align="left">
				<?php /*echo $rating;*/ ?>
			</td>	
		</tr>-->
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_LABEL_PICTURE_URL_UPLOAD;?>:</strong>
		    	</td>
			<td align="left">
			<input class="inputbox" type="file" name="image_link" value="<?php echo $row->image_link;?>" size="50" maxlength="250" />

			<br /><?php /*echo _REALESTATE_MANAGER_LABEL_PICTURE_URL_DESC;*/?>
		    	</td>
		</tr>
		<tr>
			<?php if($row->image_link!='') 		
			echo '<td valign="bottom" align="right">
				<strong>'._REALESTATE_MANAGER_ADMIN_SELECT_PHOTOS_REMOVE.':</strong>
			      </td>';
			else 
			echo '<td>&nbsp</td>';
			?>
<!--
			<td valign="top" align="right">
				<strong><?php echo _REALESTATE_MANAGER_ADMIN_REMOVE_MAIN_PHOTO;?>:</strong>				
		    	</td>
-->

			<td align="left">
				<?php
				if ($row->image_link!='') {
					$main_pth=pathinfo($row->image_link);
					$main_photo_type='.'.$main_pth['extension'];
					$main_photo_name=basename($row->image_link,$main_photo_type);
				} else {
					echo 'The main image is absent';
				}
				/*$main_photo_name=substr($row->image_link, 0, strlen($row->image_link)-4);
				$main_photo_type=substr($row->image_link, strlen($row->image_link)-4);*/
        if ($row->image_link!=''){
          echo '<input type="checkbox" name="del_main_photo" value="<?php echo $row->image_link;?>" />';  
        ?>        
        <img alt="photo" src="<?php echo $mosConfig_live_site;?>/components/com_realestatemanager/photos/<?php echo $main_photo_name."_mini".$main_photo_type;?>"/>
        <?php
        }
        ?>        
<!--  -->
		    	</td>
		</tr>
		<tr>
			<td colspan="2">&nbsp</td>
		</tr>		
		
		<tr>
			<td valign="top" align="right"> 
				<strong><?php echo _REALESTATE_MANAGER_LABEL_OTHER_PICTURES_URL_UPLOAD;?>:</strong>
		    	</td>
			<td align="left">
				<div ID="items">
				<input class="inputbox" type="button" name="new_photo" 
					value="<?php echo _REALESTATE_MANAGER_ADMIN_ADD_NEW_PHOTO; ?>" onClick="new_photos()" ID="add"/>
				</div>
		    	</td>
		</tr>

		<?php 
				if(count($house_photos)!=0){
		?>
		<tr>
			<td valign="bottom" align="right">
				<strong><?php echo _REALESTATE_MANAGER_ADMIN_SELECT_PHOTOS_REMOVE?>:</strong>
			</td>

			<td valign="top" align="right">
				<?php 
				for($i=0;$i<count($house_photos);$i++)
				{
				$photo_pth=pathinfo($house_photos[$i]->main_img);
				$photo_type='.'.$photo_pth['extension'];
				$photo_name=basename($house_photos[$i]->main_img,$photo_type);
				/*$photo_name=substr($house_photos[$i]->main_img, 0, strlen($house_photos[$i]->main_img)-4);
				$photo_type=substr($house_photos[$i]->main_img, strlen($house_photos[$i]->main_img)-4);*/
				?>
				<input type="checkbox" name="del_photos[]" value="<?php echo $house_photos[$i]->main_img;?>" />

				<img src="<?php echo $mosConfig_live_site;?>/components/com_realestatemanager/photos/<?php echo $photo_name."_mini".$photo_type;?>" alt="no such file"/><br/>
				<?php } ?>
			</td>
		</tr>
		<?php } ?>
		<tr>
			<td colspan="2">&nbsp;	
			</td>
		</tr>


<!--
//**********************************   begin change review   ***********************
-->
     <?php if ($reviews > false) /*show, if review exist*/
	      {?>
		<tr>
			<td colspan="7">
			  <hr width="100%" size="2" align="left"> <h3><?php echo _REALESTATE_MANAGER_LABEL_REVIEWS;?>:</h3> 
			</td>
		</tr>
		<table class="adminlist">
			<tr class="row0">
				<td width="3%" valign="top" align="center">
					<div>#</div>
				</td>
				<td width="2%" valign="top" align="center">
					<div></div>
				</td>
				<td width="10%" valign="top" align="center">
					<strong><?php echo _REALESTATE_MANAGER_LABEL_REVIEW_TITLE;?>:</strong>
				</td>
				<td width="10%" valign="top" align="center">
					<strong><?php echo _REALESTATE_MANAGER_LABEL_RENT_USER;?>:</strong>
				</td>
				<td width="65%" valign="top" align="center">
					<strong><?php echo _REALESTATE_MANAGER_LABEL_REVIEW_COMMENT;?>:</strong>
				</td>
				<td width="5%" valign="top" align="center">
					<strong><?php echo _REALESTATE_MANAGER_LABEL_BUILD_YEAR;?>:</strong>
				</td>
				<td width="5%" valign="top" align="center">
					<strong><?php echo _REALESTATE_MANAGER_LABEL_REVIEW_RATING;?>:</strong>
				</td>
			</tr>
	  <?php for ($i=0,$nn=1; $i<count($reviews); $i++,$nn++) /*if not one comment*/
		    {?>
			<tr class="row0">
				<td valign="top" align="center">
					<div><?php echo $nn;?></div>
				</td>
				<td valign="top" align="center">
					<div>
					<?php echo "<input type='radio' id='cb".$i."' name='bid[]' value='".$row->id.",".$reviews[$i]->id."' onclick='isChecked(this.checked);' />";   ?>
					</div>
				</td>
				<td valign="top" align="center">
					<div><?php print_r($reviews[$i]->title); ?></div>
				</td>
				<td valign="top" align="left">
					<div><?php print_r($reviews[$i]->user_name);?></div>
				</td>
				<td valign="top" align="left">
					<div><?php print_r(strip_tags($reviews[$i]->comment) );?></div>
				</td>
				<td valign="top" align="left">
					<div><?php print_r($reviews[$i]->date);?></div>
				</td>
				<td valign="top" align="left">
					<div><img src="../components/com_realestatemanager/images/rating-<?php echo $reviews[$i]->rating; ?>.gif" alt="<?php echo ($reviews[$i]->rating)/2; ?>" border="0" align="right"/>&nbsp;</div>
				</td>
			</tr>
	      <?php }/*end for(...)*/?>

		</table>
	<?php }/*end if(...)*/?>

		</table>

		<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="task" value="" />				
		</form>
<!--************************   end change review ***********************-->

		<?php

}

function showRentHouses($option, & $rows, & $userlist, $type)
{
global $my, $mosConfig_live_site,$mainframe, $doc;

$doc->addStyleSheet($mosConfig_live_site.'/includes/js/calendar/calendar-mos.css');
$doc->addStyleSheet($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css');
$doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');
$doc->addScript($mosConfig_live_site.'/includes/js/mambojavascript.js');
$doc->addScript($mosConfig_live_site.'/includes/js/calendar/calendar.js');
$doc->addScript($mosConfig_live_site.'/includes/js/calendar/lang/calendar-en-GB.js');
$doc->addScript($mosConfig_live_site.'/includes/js/overlib_mini.js');

?>


		<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
		<form action="index.php" method="post" name="adminForm" id="adminForm">
      <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
          <td width="100%" class="house_manager_caption"  >
          <?php
			if ($type == "rent") {
				echo _REALESTATE_MANAGER_SHOW_RENT_HOUSES;
			} else
				if ($type == "rent_return") {
					echo _REALESTATE_MANAGER_SHOW_RENT_RETURN;
				} if ($type == "edit_rent") {
          echo _REALESTATE_MANAGER_SHOW_RENT_EDIT;
        } else {

					echo "&nbsp;";
				}
        ?>
		   </td>
      </tr>		
      <tr>
         <td align="left">&nbsp;
         </td>
      </tr>
		</table>
<?php
			if ($type == "rent" or $type == "edit_rent") {
?>
				<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
		     <td align="center" nowrap="nowrap">
					 <?php echo _REALESTATE_MANAGER_LABEL_RENT_TO .':'; ?>
				  </td>
				  <td align="center" nowrap="nowrap">
					 <?php echo $userlist; ?>
  		    </td>
				  <td align="center" nowrap="nowrap">
					  <?php echo _REALESTATE_MANAGER_LABEL_RENT_USER .':'; ?>
          </td>
          <td>  
              <input type="text" name="user_name" class="inputbox" />
          </td>

          <td width="1000%">
          </td>
				 </tr>
				 <tr>
          <td align="left">&nbsp;
          </td>
          
          <td align="left">&nbsp;
          </td>
          
          <td align="left" nowrap="nowrap">
              <?php echo _REALESTATE_MANAGER_LABEL_RENT_EMAIL .':'; ?>
          </td>
          <td>    
              <input type="text" name="user_email" class="inputbox" />
          </td>
          <td width="30%">&nbsp;
          </td>
        </tr>
        <tr>


<td align="left" nowrap="nowrap">
            <?php echo "Rent from:"; ?>
          </td>
				  <td align="left" nowrap="nowrap">
<!--              <input class="inputbox" type="text" name="rent_from" id="rent_from" size="12" maxlength="10" value="<?php echo date("Y-m-d H:i:s"); ?>" />
              <input type="reset" class="button" value="..." onClick="return showCalendar('rent_from', 'y-mm-dd');" />-->
<?php echo JHtml::_('calendar',date("Y-m-d"), 'rent_from','rent_from','%Y-%m-%d' );  ?>    
				   </td>



          <td align="left" nowrap="nowrap">
            <?php echo _REALESTATE_MANAGER_LABEL_RENT_TIME .':'; ?>
          </td>
				  <td align="left" nowrap="nowrap">
<!--              <input class="inputbox" type="text" name="rent_until" id="rent_until" size="12" maxlength="10" value="<?php echo date("Y-m-d H:i:s"); ?>" />
              <input type="reset" class="button" value="..." onClick="return showCalendar('rent_until', 'y-mm-dd');" />-->
				  <?php echo JHtml::_('calendar',date("Y-m-d"), 'rent_until','rent_until','%Y-%m-%d' ); ?>  
  </td>





				   <td colspan="3">&nbsp;
           </td>		
				</tr>
        <tr>
            <td align="left">&nbsp;
            </td>
				</tr>
				</table>
<?php
			} else {
?>
		&nbsp;
<?php
			}
		


			$all = &JFactory::getDBO();
				//$row->htitle
				
			
			$query ="SELECT * FROM #__rem_rent ";	
			$all->setQuery( $query);
		 	$num = $all->loadObjectList();		?>
		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		 	<tr>
       <th width="20" align="center">
          <input type="checkbox"  checked="checked" name="toggle" value="" onClick="checkAll(<?php echo count( $num ); ?>);" />
        </th>
        <th align = "center" width="30">#</th>
        <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_HOUSEID; ?></th>
        <th align = "center" class="title" width="25%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_ADDRESS; ?></th>
        <th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_RENT_FROM; ?></th>
        <th align = "center" class="title" width="20%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_RENT_UNTIL; ?></th>
        <th align = "center" class="title" width="20%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_RENT_RETURN; ?></th>
	<th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _REALESTATE_MANAGER_LABEL_RENT_TO; ?></th>
	    </tr>

<?php
		

			

			for ($i = 0, $n = count($rows); $i < $n; $i ++) {
				$row = & $rows[$i];
?>
			<!--<tr class="row<?php echo $i % 2; ?>">
				<td width="20" align="center">-->
<?php
				//error for this row rent was called even if the House is already lent out
				if ($row->rent_from != null && $type == "rent") {
?>
					&nbsp;
<?php
				//rent was called for a correct House
				} else if ($row->rent_from == null && $type == "rent") {
?>
					<!--<input type="checkbox" checked="checked" id="cb<?php echo $i;?>" name="bid[]" value="<?php echo $row->id; ?>" onClick="isChecked(this.checked);" />-->
<?php
				//rent return was called on a House which was not rent out
				} else if ($row->rent_from == null && $type == "rent_return") {
?>
					&nbsp;
<?php
				//rent return was called correctly
				} else if ($row->rent_from != null && $type == "rent_return") {
?>

<?php
				
} else {
?>
				&nbsp;
<?php
				}
?>
				</td>
         <input class="inputbox" type="hidden"  name="houseid" id="houseid" size="0" maxlength="0" value="<?php echo $row->houseid; ?>" />
<input class="inputbox"  type="hidden"  name="id" id="id" size="0" maxlength="0" value="<?php echo $row->id; ?>" />			
<input class="inputbox"  type="hidden"  name="id2" id="id2" size="0" maxlength="0" value="<?php echo $row->id; ?>" />		
<!--				<input type="checkbox" checked="checked" id="cb<?php echo $i;?>" name="bid[]" value="<?php echo $row->id; ?>" onClick="isChecked(this.checked);" />	
		-->



			<?php  

			//print_r($id);
			$house=$row->id;
			$title=$row->htitle;			
			$data = &JFactory::getDBO();
				//$row->htitle
				
			
			$query ="SELECT * FROM #__rem_rent WHERE fk_houseid=".$house." ORDER BY rent_return ";// AND id =50"	
			
			//$query2 ="SELECT * FROM #__rem_rent WHERE fk_houseid=".$id." ";		
			
			//$data->setQuery( $query2);
			
			$data->setQuery( $query);
		 	$allrent = $data->loadObjectList();

	 if ($type == "rent") {	  //print_r($row);	
?>


 <td align="center"><input type="checkbox"  id="checkhouse" name="checkhouse" value="on" onClick="isChecked(this.checked);" /></td>

	
				<?php print_r("

				<td align=\"center\"></td>
				<td align=\"center\">".$row->houseid."</td>
				<td align=\"center\">".$row->hlocation."</td>
				<td align=\"center\">". " "."</td>
				<td align=\"center\">"." "."</td>	
				<td align=\"center\">"." "."</td>	
				<td align=\"center\">"." "."</td> </tr>");


				 print_r("
				<td align=\"center\">-------- </td>
				<td align=\"center\">-------</td>
				<td align=\"center\">"."------------"."</td>
				<td align=\"center\">"."-----------------"."</td>
				<td align=\"center\">". " -------------"."</td>
				<td align=\"center\">"." ---------"."</td>	
				<td align=\"center\">"." ---------------------"."</td>	
				<td align=\"center\">"."------------------"."</td> </tr>");
				
	} else if( $type == "edit_rent"){
?>        <input type="hidden"  name="checkhouse" id="checkhouse" value="on" /></td>
  <?php
	}
				
$num = 1;
for ($i = 0, $n = count($allrent); $i < $n;$i++) { 
		//$row2 = & $rows[$i];

  ?>
				

	<?php if ($type != "rent" ) {

		if(!trim($allrent[$i]->rent_return)) { ?>	
	<td align="center"><input type="checkbox"  id="cb<?php echo $i;?>" name="bid[]" value="<?php echo $allrent[$i]->id; ?>"    onClick="isChecked(this.checked);" /></td>
<?php 
		}else{ ?>
	<td align="center"><input type="hidden"  id="Test" name="Test"     onClick="isChecked(this.checked);" /></td>


		<?php 	}
	}else{ ?>
	<td align="center"><input   TYPE="hidden"  id="cb<?php echo $i;?>" name="bid[]" value="<?php echo $allrent[$i]->id; ?>" onClick="isChecked(this.checked);" /></td>

<?php  }


 ?>
		
		<?php print_r("

		<td align=\"center\">".$num."</td>
		<td align=\"center\">".$row->houseid."</td>
		<td align=\"center\">".$row->hlocation."</td>
		<td align=\"center\">". $allrent[$i]->rent_from."</td>
		<td align=\"center\">".$allrent[$i]->rent_until."</td>	
		<td align=\"center\">".$allrent[$i]->rent_return."</td>	
		<td align=\"center\">".$allrent[$i]->user_name.":  ".$allrent[$i]->user_email."</td> </tr>");
		
		$num++;	}
		?>
			
<?php  } 			
		


?>
<input class="inputbox"  type="hidden"  name="mas" id="mas" size="0" maxlength="0" value="<?php echo $allrent; ?>" />
		</table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="1" />
		<input type="hidden" name="save" value="1" />
		</form>

<?php 
			}

function showConfiguration($lists, $option, $txt) 
{

  global $my, $mosConfig_live_site,$mainframe,$act, $task;
  $doc =& JFactory::getDocument();

  $doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );
  $doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');

?>

      <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

      <script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>

      <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
          <td width="30%">
             <img src="./components/com_realestatemanager/images/building_icon.jpg" align="right" alt ="Config" />
          </td>
          <td width="70%" class="house_manager_caption" valign='bottom' >
              <?php echo _REALESTATE_MANAGER_ADMIN_CONFIG ?>
          </td>
      </tr>
      </table>

      <form action="index.php" method="post" name="adminForm" id="adminForm">

<?php
	$tabs = new mosTabs(1);
  $tabs->startPane("impexPane");
	$tabs->startTab(_REALESTATE_MANAGER_ADMIN_CONFIG_FRONTEND, "impexPane");
?>
      <h1><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_FRONTEND; ?></h1>
      <table class="adminform" border="0">
      <tr  >
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_RENTSTATUS_SHOW; ?>:</td>

         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_RENTSTATUS_SHOW_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_RENTSTATUS_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['rentstatus']['show']; ?></td>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_RENTREQUEST_REGISTRATIONLEVEL; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_RENTREQUEST_REGISTRATIONLEVEL_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_RENTREQUEST_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
         <td><?php echo $lists['rentrequest']['registrationlevel']; ?></td>         
      </tr>      

  <tr>
      	<td colspan="6">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_BUYSTATUS_SHOW; ?>:</td>

         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_BUYSTATUS_SHOW_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_BUYSTATUS_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['buystatus']['show']; ?></td>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_BUYREQUEST_REGISTRATIONLEVEL; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_BUYREQUEST_REGISTRATIONLEVEL_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_BUYREQUEST_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
         <td><?php echo $lists['buyrequest']['registrationlevel']; ?></td>         
      </tr>      

  <tr>
      	<td colspan="6">
      		<hr />
      	</td>
      </tr>

   <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_REVIEWS_SHOW; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_REVIEWS_SHOW_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_REVIEWS_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['reviews']['show']; ?></td>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_REVIEWS_REGISTRATIONLEVEL; ?>:</td>         
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_REVIEWS_REGISTRATIONLEVEL_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_REVIEWS_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
         <td><?php echo $lists['reviews']['registrationlevel']; ?></td>         
      </tr>

   <tr>
  <td colspan="6">
    <hr />
  </td>
      </tr>

      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_PRICE_SHOW; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_PRICE_SHOW_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_PRICE_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['price']['show']; ?></td>
         <td width="185"></td>
         <td width="20"></td>
         <td></td> 
      </tr>
      <tr>
      	<td colspan="6">
	  <hr />
	</td>
      </tr>

	<tr>
		<td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_SHOW; ?>:</td>
		<td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_SHOW_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_SHOW_TT_HEAD ); ?></td>
		<td><?php echo $lists['edocs']['show']; ?></td>
		<td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_REGISTRATIONLEVEL; ?>:</td>
		<td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_REGISTRATIONLEVEL_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
		<td><?php echo $lists['edocs']['registrationlevel']; ?></td>
      </tr>
      <tr>
      	<td colspan="6">
	  <hr />
	</td>
      </tr>
<!--
//***********************************************************************************************
//				begin add PageItems
//***********************************************************************************************
-->
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_PAGE_ITEMS; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_PAGE_ITEMS_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_PAGE_ITEMS_TT_HEAD ); ?></td>
         <td><?php echo $lists['page']['items']; ?></td>
      </tr>
<!--*******	end add PageItems ************ -->
<!--********   begin add for show in category picture   **************-->
      <tr>
      	<td colspan="6">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_PICTURE_IN_CATEGORY; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_PICTURE_IN_CATEGORY_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_PICTURE_IN_CATEGORY_TT_HEAD ); ?></td>
         <td><?php echo $lists['cat_pic']['show']; ?></td>
      </tr>
<!--***************   end add for show in category picture  *************-->

<!--********   begin add for show subcategory   **************-->
      <tr>
        <td colspan="6">
          <hr />
        </td>
      </tr>
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_SUBCATEGORY_SHOW; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_SUBCATEGORY_SHOW_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_SUBCATEGORY_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['subcategory']['show']; ?></td>
      </tr>
<!--***************   end add for show subcategory *************-->



<!--********   begin add for view type   **************-->
      <tr>
        <td colspan="6">
          <hr />
        </td>
      </tr>
      <tr>
        <td width="185"><?php echo _REALESTATE_MANAGER_CONFIG_VIEW_TYPE; ?>:</td>
        <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_CONFIG_VIEW_TYPE_TT_BODY, _REALESTATE_MANAGER_CONFIG_VIEW_TYPE_TT_HEAD ); ?></td>
        <td><?php echo $lists['view_type']; ?></td>
      </tr>
<!--***************   end add for view type *************-->
     </table>
    <!--input type="hidden" name="option" value="<?php echo $option; ?>" />
    <input type="hidden" name="task" value="config_save_frontend" /-->

<?php
	$tabs->endTab();
	$tabs->startTab(_REALESTATE_MANAGER_ADMIN_CONFIG_BACKEND, "impexPane");
?>
	<h1><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_BACKEND; ?></h1>

	<table class="adminform">
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_DOWNLOAD; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_DOWNLOAD_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_DOWNLOAD_TT_HEAD ); ?></td>
         <td><?php echo $lists['edocs']['allow']; ?></td>
      </tr>

      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_DOWNLOAD_LOCATION; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_DOWNLOAD_LOCATION_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_EDOCUMENTS_DOWNLOAD_LOCATION_TT_HEAD ); ?></td>
         <td><?php echo $lists['edocs']['location']; ?></td>
      </tr>
      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_PHOTOS_DOWNLOAD_LOCATION; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_PHOTOS_DOWNLOAD_LOCATION_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_PHOTOS_DOWNLOAD_LOCATION_TT_HEAD ); ?></td>
         <td><?php echo $lists['photos']['location']; ?></td>
      </tr>
      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>
<!--********   begin add for google map key  **************-->
      <tr>
         <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_CONFIG_GOOGLEMAP_KEY; ?>:</td>
         <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_CONFIG_GOOGLEMAP_KEY_TT_BODY, _REALESTATE_MANAGER_ADMIN_CONFIG_GOOGLEMAP_KEY_TT_HEAD ); ?></td>
         <td><?php echo $lists['google_map']['key']; ?></td>
      </tr>
      <tr>
        <td colspan="3">
          <hr />
        </td>
      </tr>
<!--***************   end add for google map key *************-->
<!--********   begin add update  **************-->
      <tr>
        <td width="185"><?php echo _REALESTATE_MANAGER_ADMIN_UPDATE; ?>:</td>
        <td width="20"><?php echo mosToolTip( _REALESTATE_MANAGER_ADMIN_UPDATE_TT_BODY, _REALESTATE_MANAGER_ADMIN_UPDATE_TT_HEAD ); ?></td>
        <td><?php echo $lists['update']; ?></td>
      </tr>
      <tr>
        <td colspan="3">
          <hr />
        </td>
      </tr>
<!--***************   end add update *************-->
     </table>
<?php
  $tabs->endTab();
  $tabs->endPane();
?>
        <input type="hidden" name="option" value="<?php echo $option; ?>" />
        <input type="hidden" name="task" value="config_save" />
     </form>

<?php
   }
//------------------------------------------------------------------
   function about() {

      global $mosConfig_live_site,$mainframe;
      $tabs = new mosTabs(0);
      global $doc;
      $doc->addStyleSheet( $mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/realestatemanager.css' );

?>
    <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
    <script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>

    <table cellpadding="4" cellspacing="0" border="0" width="100%">
      <tr>
        <td width="30%">
          <img src="./components/com_realestatemanager/images/building_icon.jpg" align="right" alt="Config" />
        </td>
        <td width="70%" class="house_manager_caption" valign='bottom' >
                <?php echo _REALESTATE_MANAGER_ADMIN_ABOUT ?>
        </td>
      </tr>
    </table>

<form action="index.php" method="post" name="adminForm" id="adminForm">
<?php
      $tabs->startPane("aboutPane");
      $tabs->startTab(_REALESTATE_MANAGER_ADMIN_ABOUT_ABOUT, "display-page");
?>
      <table class="adminform">
	      <tr>
	        <td width="80%">
				<h3><?PHP echo _REALESTATE_MANAGER__HTML_ABOUT; ?></h3>
				<?PHP echo _REALESTATE_MANAGER__HTML_ABOUT_INTRO; ?>
			</td>
	         <td width="20%">
<img src="../components/com_realestatemanager/images/rem_logo.png" align="right" alt="Real Estate Manager logo" />
	         </td>	         
	      </tr>

      </table>

<?php
      $tabs->endTab();
//******************************   tab--2 about   **************************************
      $tabs->startTab(_REALESTATE_MANAGER_ADMIN_ABOUT_RELEASENOTE, "display-page");
      include_once("./components/com_realestatemanager/doc/releasenote.php");
      $tabs->endTab();
//******************************   tab--3 about--changelog.txt   ***********************
      $tabs->startTab(_REALESTATE_MANAGER_ADMIN_ABOUT_CHANGELOG, "display-page");
      include_once("./components/com_realestatemanager/doc/changelog.html");
      $tabs->endTab();

      $tabs->endPane();
?>
	<!--        <input type="hidden" name="option" value="<?php /*echo $option; */?>">  -->
      </form>
<?php
   }
	function showImportResult($table, $option){
global $my, $mosConfig_live_site,$mainframe;
$doc =& JFactory::getDocument();  $doc->addScript($mosConfig_live_site.'/administrator/components/com_realestatemanager/includes/functions.js');

	?>
		<form action="index.php" method="post" name="adminForm" id="adminForm">
			<table cellpadding='4' cellspacing='0' border='1' width='100%'>
				<tr>
	    			<td>#</td>
	    			<td><?php echo _REALESTATE_MANAGER_LABEL_HOUSEID;?></td>
<!--	    			<td><?php echo _REALESTATE_MANAGER_LABEL_MLS;?></td>
-->
	    			<td><?php echo _REALESTATE_MANAGER_LABEL_ADDRESS;?></td>
	    			<td><?php echo _REALESTATE_MANAGER_LABEL_TITLE;?></td>
	    			<td><?php echo _REALESTATE_MANAGER_LABEL_BROKER;?></td>
	    			<td><?php echo _REALESTATE_MANAGER_LABEL_STATUS;?></td>
	    		</tr>

			<?php foreach ($table as $entry){
			?>
				<tr>
	    			<td><?php echo $entry[0]+1; ?></td>
	    			<td><?php echo $entry[1]; ?></td>
	    			<td><?php echo $entry[2]; ?></td>
	    			<td><?php echo $entry[3]; ?></td>
	    			<td><?php echo $entry[4]; ?></td>
	    			<td><?php echo $entry[5]; ?></td>
<!--
	    			<td><?php echo $entry[6]; ?></td>
-->
	    		</tr>
			<?php
	
		}
			?>
				</table>
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="cancel" />
			</form>	

<?php	

	}
}
